#include<bits/stdc++.h>

using namespace std;
const int maxn = 2e5;
int A[maxn], n = 0;//vector
int p, q, x;

int main() {
    cin >> q;
    while (q--) {
        cin >> p;
        if (p == 0) {
            cin >> x;
            A[n++] = x;
        } else if (p == 1) {
            cin >> x;
            cout << A[x] << endl;
        } else if (p == 2) {
            n--;
        }
    }

    return 0;
}